package com.carleasoft.mps.core.perm;

import com.carleasoft.mps.core.user.UserCacheData;

/**
 * @program:
 * @description:
 * @author: ztm
 * @create: 2019/11/22 21:37
 **/
public class ThreadPermDataContext implements AutoCloseable{

    static final ThreadLocal<DataPermCache> current = new ThreadLocal<>();

    public ThreadPermDataContext(DataPermCache dataPermCache) {
        current.set(dataPermCache);
    }

    public static DataPermCache getCurrentDataPermCache() {
        return current.get();
    }

    public void close() {
        current.remove();
    }

    public static void set(DataPermCache dataPermCache){
        current.set(dataPermCache);
    }

}
